import { getSongDetail } from "../../../api/player";
import { CHANGE_SONG_DETAIL } from "./constants";

export const changeSongDetail = payload => ({
  type: CHANGE_SONG_DETAIL,
  payload,
});

export const getSongDetailAction = ids => {
  return dispatch => {
    getSongDetail(ids).then(res => {
      console.log(res);
      dispatch(changeSongDetail(res.songs && res.songs[0]));
    });
  };
};
